package com.util;

import com.model.User;
import org.apache.commons.codec.digest.DigestUtils;

/**
 * Created with IntelliJ IDEA.
 * User: gg
 * Date: 14-4-16
 * Time: 下午4:48
 * To change this template use File | Settings | File Templates.
 */
public class Utils {
    public static User getUserByUsername(String username) {
        User user = null;
        if ("admin".equals(username)) {
            user = new User();
            user.setName("admin");
            user.setPassword(DigestUtils.md5Hex("123456"));
        }
        return user;
    }

    public static boolean judgeClientIpByName(String name) {
        return true;
    }

    public static boolean validateMD5Info(String content, String md5) {
        boolean flag = false;
        String s = DigestUtils.md5Hex(content);
        if (md5.equals(s)) {
            flag = true;
        }
        return flag;
    }
}
